function myCalculator(init) { // constructor
    const that = this // 实例 防止this丢失  依然指向实例
    that.num = init || 0

    myCalculator.prototype.plus = function(num) {
        that.num += +num; // + 类型转换
        return myCalculator.prototype
    }
    myCalculator.prototype.minus = function(num) {
        that.num -= +num; // + 类型转换
        return myCalculator.prototype
    }
    myCalculator.prototype.times = function(num) {
        that.num *= +num;
        return myCalculator.prototype
    }
    myCalculator.prototype.dividedBy = function(num) {
        that.num /= +num;
        return myCalculator.prototype
    }
    myCalculator.prototype.equals = function() {
        return that.num
    }
    return myCalculator.prototype;
}
console.log(myCalculator(1).plus(1).times(3).equals()) // 6
console.log(myCalculator(121).plus(1).minus(2).times(3).dividedBy(4).equals());
console.log(myCalculator(1))
myCalculator(1) // 函数的运行结果是他的原型对象